﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RazakiControls
{
    [DefaultProperty("Caption")]
    [ToolboxData("<{0}:RazakiLabel runat=server />")]
    [ToolboxBitmap(typeof(RazakiLabel), "Images.DefaultControl.ico")]
    public class RazakiLabel : Label
    {
        [Category("Appearance")]
        [Localizable(true)]
        public string Caption { get; set; }

        protected override void Render(HtmlTextWriter writer)
        {
            if (!string.IsNullOrWhiteSpace(Caption))
            {
                //#01
                writer.AddStyleAttribute("float", "right");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.Write(string.Format("{0}:&nbsp;", Caption));

                //#01
                writer.RenderEndTag();
            }
         
            base.Render(writer);
        }
    }
}